/*
 * @Author: ljkt
 * @Version: 1.0
 * @Date: 2021-10-26 15:50:58
 * @LastEditors: ljkt
 * @LastEditTime: 2025-03-29 23:20:04
 * @Description:
 */

#ifndef _APP_COM_H__
#define _APP_COM_H__
#define LX1_1_COM (C8620_Row6)
#define LX1_1_SEG (0L)
#define LX1_2_COM (C8620_Row7)
#define LX1_2_SEG (0L)
#define LX1_3_COM (C8620_Row5)
#define LX1_3_SEG (7L)
#define LX1_4_COM (C8620_Row5)
#define LX1_4_SEG (6L)
#define LX1_5_COM (C8620_Row5)
#define LX1_5_SEG (5L)

#define LX2_1_COM (C8620_Row5)
#define LX2_1_SEG (4L)
#define LX2_2_COM (C8620_Row7)
#define LX2_2_SEG (1L)
#define LX2_3_COM (C8620_Row5)
#define LX2_3_SEG (3L)
#define LX2_4_COM (C8620_Row5)
#define LX2_4_SEG (2L)
#define LX2_5_COM (C8620_Row5)
#define LX2_5_SEG (1L)

#define LX3_1_COM (C8620_Row5)
#define LX3_1_SEG (0L)
#define LX3_2_COM (C8620_Row7)
#define LX3_2_SEG (2L)
#define LX3_3_COM (C8620_Row4)
#define LX3_3_SEG (7L)
#define LX3_4_COM (C8620_Row4)
#define LX3_4_SEG (6L)
#define LX3_5_COM (C8620_Row4)
#define LX3_5_SEG (5L)

#define SZ1_SEGA_COM (C8620_Row1)
#define SZ1_SEGA_SEG (0L)
#define SZ1_SEGB_COM (C8620_Row1)
#define SZ1_SEGB_SEG (1L)
#define SZ1_SEGC_COM (C8620_Row1)
#define SZ1_SEGC_SEG (2L)
#define SZ1_SEGD_COM (C8620_Row1)
#define SZ1_SEGD_SEG (3L)
#define SZ1_SEGE_COM (C8620_Row1)
#define SZ1_SEGE_SEG (4L)
#define SZ1_SEGF_COM (C8620_Row1)
#define SZ1_SEGF_SEG (5L)
#define SZ1_SEGG_COM (C8620_Row1)
#define SZ1_SEGG_SEG (6L)

#define SZ2_SEGA_COM (C8620_Row2)
#define SZ2_SEGA_SEG (0L)
#define SZ2_SEGB_COM (C8620_Row2)
#define SZ2_SEGB_SEG (1L)
#define SZ2_SEGC_COM (C8620_Row2)
#define SZ2_SEGC_SEG (2L)
#define SZ2_SEGD_COM (C8620_Row2)
#define SZ2_SEGD_SEG (3L)
#define SZ2_SEGE_COM (C8620_Row2)
#define SZ2_SEGE_SEG (4L)
#define SZ2_SEGF_COM (C8620_Row2)
#define SZ2_SEGF_SEG (5L)
#define SZ2_SEGG_COM (C8620_Row2)
#define SZ2_SEGG_SEG (6L)

#define SZ3_SEGA_COM (C8620_Row3)
#define SZ3_SEGA_SEG (0L)
#define SZ3_SEGB_COM (C8620_Row3)
#define SZ3_SEGB_SEG (1L)
#define SZ3_SEGC_COM (C8620_Row3)
#define SZ3_SEGC_SEG (2L)
#define SZ3_SEGD_COM (C8620_Row3)
#define SZ3_SEGD_SEG (3L)
#define SZ3_SEGE_COM (C8620_Row3)
#define SZ3_SEGE_SEG (4L)
#define SZ3_SEGF_COM (C8620_Row3)
#define SZ3_SEGF_SEG (5L)
#define SZ3_SEGG_COM (C8620_Row3)
#define SZ3_SEGG_SEG (6L)

typedef struct
{
    unsigned char head;
    unsigned char key_l8;
    unsigned char key_h8;
    unsigned char key_f_l8;
    unsigned char key_f_h8;
    unsigned char nc;
    unsigned char chekcsum;
} s_com_send_t;
typedef struct
{
    // BYTE1
    unsigned char Head;
    // BYTE2
    unsigned char BeepCnt : 4;
    unsigned char BeepEn : 1;
    unsigned char Byte1NC : 3;
    // BYTE3
    unsigned char BeepOnDiv10Ms;
    // BYTE4
    unsigned char BeepOffDiv10Ms;
    // BYTE5
    unsigned char COM1_Sz : 7;
    unsigned char COM1_NC : 1;
    // BYTE6
    unsigned char COM2_Sz : 7;
    unsigned char COM2_NC : 1;
    // BYTE7
    unsigned char COM3_Sz : 7;
    unsigned char COM3_NC : 1;
    // BYTE8
    unsigned char COM1_SEG8 : 2;
    unsigned char COM2_SEG8 : 2;
    unsigned char COM3_SEG8 : 2;
    unsigned char NC_SEG8 : 2;
    // BYTE9
    unsigned char COM4_SEG1 : 2;
    unsigned char COM4_SEG2 : 2;
    unsigned char COM4_SEG3 : 2;
    unsigned char COM4_SEG4 : 2;
    // BYTE10
    unsigned char COM4_SEG5 : 2;
    unsigned char COM4_SEG6 : 2;
    unsigned char COM4_SEG7 : 2;
    unsigned char COM4_SEG8 : 2;
    // BYTE11
    unsigned char COM5_SEG1 : 2;
    unsigned char COM5_SEG2 : 2;
    unsigned char COM5_SEG3 : 2;
    unsigned char COM5_SEG4 : 2;
    // BYTE12
    unsigned char COM5_SEG5 : 2;
    unsigned char COM5_SEG6 : 2;
    unsigned char COM5_SEG7 : 2;
    unsigned char COM5_SEG8 : 2;
    // BYTE13
    unsigned char COM6_SEG1 : 2;
    unsigned char COM6_SEG2 : 2;
    unsigned char COM6_SEG3 : 2;
    unsigned char COM6_SEG4 : 2;
    // BYTE14
    unsigned char COM6_SEG5 : 2;
    unsigned char COM6_SEG6 : 2;
    unsigned char COM6_SEG7 : 2;
    unsigned char COM6_SEG8 : 2;
    // BYTE15
    unsigned char COM7_SEG1 : 2;
    unsigned char COM7_SEG2 : 2;
    unsigned char COM7_SEG3 : 2;
    unsigned char COM7_SEG4 : 2;
    // BYTE16
    unsigned char COM7_SEG5 : 2;
    unsigned char COM7_SEG6 : 2;
    unsigned char COM7_SEG7 : 2;
    unsigned char COM7_SEG8 : 2;

    // BYTE17
    unsigned char COM8_SEG1 : 2;
    unsigned char COM8_SEG2 : 2;
    unsigned char COM8_SEG3 : 2;
    unsigned char COM8_SEG4 : 2;
    // BYTE18
    unsigned char COM8_SEG5 : 2;
    unsigned char COM8_SEG6 : 2;
    unsigned char COM8_SEG7 : 2;
    unsigned char COM8_SEG8 : 2;

    unsigned char CheckSum;
} s_com_recv_c8620_38_t;
typedef struct
{
    unsigned char txflag;
    unsigned char RxFlag;
    s_com_recv_c8620_38_t RecvDat;
} s_app_com_t;
extern Ram s_app_com_t gApp_Com;
void App_Com_Init(void);
void App_Com_Scan(void);
#endif
